package com.trt.eatmeat.util;

import java.io.Serializable;

public class ResponseData<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private Integer result;
    private T data;
    private Integer errorCode;
    private String msg;

    public ResponseData() {
    }

    public ResponseData<T> success(T data) {
        this.result = 0;
        this.data = data;
        this.msg ="success";
        return this;
    }

    public ResponseData<T> fail(Integer errCode, String errMsg) {
        this.result = 1;
        this.msg = errMsg;
        this.errorCode = errCode;
        return this;
    }

    public Integer getResult() {
        return this.result;
    }

    public void setResult(Integer result) {
        this.result = result;
    }

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Integer getErrorCode() {
        return this.errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}